//柯里化案例
// ''.match(/\s+/g)
// ''.match(/\d+/g)

const _ = require('lodash')
const match = _.curry((reg,str)=>{
  return str.match(reg)
})

const haveSpace = match(/\s+/g)
const haveNum = match(/\d+/g)

const filter = _.curry((func,array)=>array.filter(func))
const findSpace = filter(haveSpace)

//console.log(haveSpace('helloworld'))
// console.log(haveNumber('abc'))

console.log(filter(haveSpace, ['John Connor', 'John_Donne']))
console.log(findSpace(['John Connor', 'John_Donne']))